package com.mindskip.xzs;

import com.mindskip.xzs.configuration.property.SystemConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @version 3.5.0
 * @description: The type Xzs application.
 * Copyright (C), 2020-2021, ITSource
 * @date 2021/12/25 9:45
 */
@SpringBootApplication
@EnableTransactionManagement
@EnableConfigurationProperties(value = { SystemConfig.class})
@Slf4j
public class XzsApplication {

    /**
     * The entry point of application.
     *
     * @param args the input arguments
     */
    public static void main(String[] args) throws UnknownHostException {
        log.info("服务开始启动~");
        ConfigurableApplicationContext applicationContext = SpringApplication.run(XzsApplication.class, args);
        ConfigurableEnvironment env = applicationContext.getEnvironment();

        log.info("\n---------------- 关注ITSource每日分享,每天分享一个 IT 资源------------------------------------------\n\t" +
                        "Application: '{}' is running! Access URLs:\n\t" +
                        "后端地址: \t\thttp://127.0.0.1:{}\n\t"+
                        "----------------------------------------------------------",
                env.getProperty("spring.application.name"),
                //InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"));
        log.info("-------服务启动完成:{}-------", InetAddress.getLocalHost().getHostAddress());
    }
}
